
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>17 状态机 · 高性能服务器开发 技术专栏</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="easy_coder">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-fexa/fexa.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../游戏开发专题/" />
    
    
    <link rel="prev" href="16线程交互.html" />
    

    </head>
    <body>
        
<div class="book">
	<div class="header-inner">
		<!-- LOGO -->
		<div class="logo"></div>
		<span class="title"></span>

		<!-- Search -->
		
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>


		<!-- Nav -->
		<ul class="header-nav">
			
		</ul>
	</div>

	<div class="book-summary">
		<div class="book-summary-title">文档目录</div>
		
		
		<nav role="navigation">
			


<ul class="summary">
    
    

    

    
        
        <li class="header">Part I</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../C++必知必会的知识点/">
            
                <a href="../C++必知必会的知识点/">
            
                    
                    C++必知必会的知识点
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../C++必知必会的知识点/如何成为一名合格的CC++开发者？.html">
            
                <a href="../C++必知必会的知识点/如何成为一名合格的CC++开发者？.html">
            
                    
                    如何成为一名合格的C/C++开发者？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../C++必知必会的知识点/不定参数函数实现var_arg系列的宏.html">
            
                <a href="../C++必知必会的知识点/不定参数函数实现var_arg系列的宏.html">
            
                    
                    不定参数函数实现var_arg系列的宏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../C++必知必会的知识点/你一定要搞明白的C函数调用方式与栈原理.html">
            
                <a href="../C++必知必会的知识点/你一定要搞明白的C函数调用方式与栈原理.html">
            
                    
                    你一定要搞明白的C函数调用方式与栈原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../C++必知必会的知识点/深入理解CC++中的指针.html">
            
                <a href="../C++必知必会的知识点/深入理解CC++中的指针.html">
            
                    
                    深入理解C/C++中的指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../C++必知必会的知识点/详解C++11中的智能指针.html">
            
                <a href="../C++必知必会的知识点/详解C++11中的智能指针.html">
            
                    
                    详解C++11中的智能指针
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../C++必知必会的知识点/C++17结构化绑定.html">
            
                <a href="../C++必知必会的知识点/C++17结构化绑定.html">
            
                    
                    C++17结构化绑定
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../C++必知必会的知识点/C++必须掌握的pimpl惯用法.html">
            
                <a href="../C++必知必会的知识点/C++必须掌握的pimpl惯用法.html">
            
                    
                    C++必须掌握的pimpl惯用法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../C++必知必会的知识点/用VisualStudio调试Linux程序.html">
            
                <a href="../C++必知必会的知识点/用VisualStudio调试Linux程序.html">
            
                    
                    用Visual Studio调试Linux程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../C++必知必会的知识点/如何使用VisualStudio管理和阅读开源项目代码.html">
            
                <a href="../C++必知必会的知识点/如何使用VisualStudio管理和阅读开源项目代码.html">
            
                    
                    如何使用Visual Studio管理和阅读开源项目代码
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../C++必知必会的知识点/利用cmake工具生成VisualStudio工程文件.html">
            
                <a href="../C++必知必会的知识点/利用cmake工具生成VisualStudio工程文件.html">
            
                    
                    利用cmake工具生成Visual Studio工程文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../多线程/">
            
                <a href="../多线程/">
            
                    
                    多线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../多线程/后台C++开发你一定要知道的条件变量.html">
            
                <a href="../多线程/后台C++开发你一定要知道的条件变量.html">
            
                    
                    后台C++开发你一定要知道的条件变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../多线程/整型变量赋值是原子操作吗？.html">
            
                <a href="../多线程/整型变量赋值是原子操作吗？.html">
            
                    
                    整型变量赋值是原子操作吗？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../网络编程/">
            
                <a href="../网络编程/">
            
                    
                    网络编程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../网络编程/bind函数重难点解析.html">
            
                <a href="../网络编程/bind函数重难点解析.html">
            
                    
                    bind 函数重难点解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../网络编程/connect函数在阻塞和非阻塞模式下的行为.html">
            
                <a href="../网络编程/connect函数在阻塞和非阻塞模式下的行为.html">
            
                    
                    connect 函数在阻塞和非阻塞模式下的行为
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../网络编程/select函数重难点解析.html">
            
                <a href="../网络编程/select函数重难点解析.html">
            
                    
                    select 函数重难点解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../网络编程/Linuxepoll模型（含LT模式和ET模式详解）.html">
            
                <a href="../网络编程/Linuxepoll模型（含LT模式和ET模式详解）.html">
            
                    
                    Linux epoll 模型（含LT 模式和 ET 模式详解）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../网络编程/socket的阻塞模式和非阻塞模式.html">
            
                <a href="../网络编程/socket的阻塞模式和非阻塞模式.html">
            
                    
                    socket 的阻塞模式和非阻塞模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../网络编程/非阻塞模式下send和recv函数的返回值.html">
            
                <a href="../网络编程/非阻塞模式下send和recv函数的返回值.html">
            
                    
                    非阻塞模式下 send 和 recv 函数的返回值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../网络编程/服务器开发通信协议设计介绍.html">
            
                <a href="../网络编程/服务器开发通信协议设计介绍.html">
            
                    
                    服务器开发通信协议设计介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="../网络编程/TCP协议如何解决粘包、半包问题.html">
            
                <a href="../网络编程/TCP协议如何解决粘包、半包问题.html">
            
                    
                    TCP 协议如何解决粘包、半包问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="../网络编程/网络通信中收发数据的正确姿势.html">
            
                <a href="../网络编程/网络通信中收发数据的正确姿势.html">
            
                    
                    网络通信中收发数据的正确姿势
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="../网络编程/服务器端发数据时，如果对端一直不收，怎么办？.html">
            
                <a href="../网络编程/服务器端发数据时，如果对端一直不收，怎么办？.html">
            
                    
                    服务器端发数据时，如果对端一直不收，怎么办？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../程序员必知必会的网络命令/">
            
                <a href="../程序员必知必会的网络命令/">
            
                    
                    程序员必知必会的网络命令
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../程序员必知必会的网络命令/利用telnet命令发电子邮件.html">
            
                <a href="../程序员必知必会的网络命令/利用telnet命令发电子邮件.html">
            
                    
                    利用telnet命令发电子邮件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../程序员必知必会的网络命令/做Java或者C++开发都应该知道的lsof命令.html">
            
                <a href="../程序员必知必会的网络命令/做Java或者C++开发都应该知道的lsof命令.html">
            
                    
                    做Java或者C++开发都应该知道的lsof命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../程序员必知必会的网络命令/Linux网络故障排查的瑞士军刀.html">
            
                <a href="../程序员必知必会的网络命令/Linux网络故障排查的瑞士军刀.html">
            
                    
                    Linux网络故障排查的瑞士军刀nc命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../程序员必知必会的网络命令/Linuxtcpdump使用介绍.html">
            
                <a href="../程序员必知必会的网络命令/Linuxtcpdump使用介绍.html">
            
                    
                    Linux tcpdump使用详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../程序员必知必会的网络命令/从抓包的角度分析connect函数的连接过程.html">
            
                <a href="../程序员必知必会的网络命令/从抓包的角度分析connect函数的连接过程.html">
            
                    
                    从抓包的角度分析connect函数的连接过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="../程序员必知必会的网络命令/服务器开发中网络数据分析与故障排查经验漫谈.html">
            
                <a href="../程序员必知必会的网络命令/服务器开发中网络数据分析与故障排查经验漫谈.html">
            
                    
                    服务器开发中网络数据分析与故障排查经验漫谈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part II</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../高性能服务器框架设计/">
            
                <a href="../高性能服务器框架设计/">
            
                    
                    高性能服务器框架设计
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../高性能服务器框架设计/主线程与工作线程的分工.html">
            
                <a href="../高性能服务器框架设计/主线程与工作线程的分工.html">
            
                    
                    主线程与工作线程的分工
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../高性能服务器框架设计/Reactor模式.html">
            
                <a href="../高性能服务器框架设计/Reactor模式.html">
            
                    
                    Reactor模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="../高性能服务器框架设计/实例：一个服务器程序的架构介绍.html">
            
                <a href="../高性能服务器框架设计/实例：一个服务器程序的架构介绍.html">
            
                    
                    实例：一个服务器程序的架构介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="../高性能服务器框架设计/错误码系统的设计.html">
            
                <a href="../高性能服务器框架设计/错误码系统的设计.html">
            
                    
                    错误码系统的设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="../高性能服务器框架设计/日志系统的设计.html">
            
                <a href="../高性能服务器框架设计/日志系统的设计.html">
            
                    
                    日志系统的设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6" data-path="../高性能服务器框架设计/如何设计断线自动重连机制.html">
            
                <a href="../高性能服务器框架设计/如何设计断线自动重连机制.html">
            
                    
                    如何设计断线自动重连机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.7" data-path="../高性能服务器框架设计/心跳包机制设计详解.html">
            
                <a href="../高性能服务器框架设计/心跳包机制设计详解.html">
            
                    
                    心跳包机制设计详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.8" data-path="../高性能服务器框架设计/业务数据处理一定要单独开线程吗.html">
            
                <a href="../高性能服务器框架设计/业务数据处理一定要单独开线程吗.html">
            
                    
                    业务数据处理一定要单独开线程吗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.9" data-path="../高性能服务器框架设计/C++高性能服务器网络框架设计细节.html">
            
                <a href="../高性能服务器框架设计/C++高性能服务器网络框架设计细节.html">
            
                    
                    C++ 高性能服务器网络框架设计细节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../服务器开发案例实战/">
            
                <a href="../服务器开发案例实战/">
            
                    
                    服务器开发案例实战
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="../服务器开发案例实战/从零实现一个http服务器.html">
            
                <a href="../服务器开发案例实战/从零实现一个http服务器.html">
            
                    
                    从零实现一个http服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="../服务器开发案例实战/从零实现一款12306刷票软件.html">
            
                <a href="../服务器开发案例实战/从零实现一款12306刷票软件.html">
            
                    
                    从零实现一款12306刷票软件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.3" data-path="../服务器开发案例实战/从零实现一个邮件收发客户端.html">
            
                <a href="../服务器开发案例实战/从零实现一个邮件收发客户端.html">
            
                    
                    从零实现一个邮件收发客户端
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.4" data-path="../服务器开发案例实战/从零开发一个WebSocket服务器.html">
            
                <a href="../服务器开发案例实战/从零开发一个WebSocket服务器.html">
            
                    
                    从零开发一个WebSocket服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.5" data-path="../服务器开发案例实战/1从一款多人联机实时对战游戏开始.html">
            
                <a href="../服务器开发案例实战/1从一款多人联机实时对战游戏开始.html">
            
                    
                    从零学习开源项目系列（一） 从一款多人联机实时对战游戏开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.6" data-path="../服务器开发案例实战/2最后一战概况.html">
            
                <a href="../服务器开发案例实战/2最后一战概况.html">
            
                    
                    从零学习开源项目系列（二） 最后一战概况
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.7" data-path="../服务器开发案例实战/3CSBattleMgr服务源码研究.html">
            
                <a href="../服务器开发案例实战/3CSBattleMgr服务源码研究.html">
            
                    
                    从零学习开源项目系列（三） CSBattleMgr服务源码研究
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.8" data-path="../服务器开发案例实战/4LogServer源码探究.html">
            
                <a href="../服务器开发案例实战/4LogServer源码探究.html">
            
                    
                    从零学习开源项目系列（四）LogServer源码探究
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part III</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../TeamTalk源码解析/">
            
                <a href="../TeamTalk源码解析/">
            
                    
                    TeamTalk IM源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="../TeamTalk源码解析/01TeamTalk介绍.html">
            
                <a href="../TeamTalk源码解析/01TeamTalk介绍.html">
            
                    
                    01 TeamTalk介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="../TeamTalk源码解析/02服务器端的程序的编译与部署.html">
            
                <a href="../TeamTalk源码解析/02服务器端的程序的编译与部署.html">
            
                    
                    02 服务器端的程序的编译与部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.3" data-path="../TeamTalk源码解析/03服务器端的程序架构介绍.html">
            
                <a href="../TeamTalk源码解析/03服务器端的程序架构介绍.html">
            
                    
                    03 服务器端的程序架构介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.4" data-path="../TeamTalk源码解析/04服务器端db_proxy_server源码分析.html">
            
                <a href="../TeamTalk源码解析/04服务器端db_proxy_server源码分析.html">
            
                    
                    04 服务器端db_proxy_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.5" data-path="../TeamTalk源码解析/05服务器端msg_server源码分析.html">
            
                <a href="../TeamTalk源码解析/05服务器端msg_server源码分析.html">
            
                    
                    05 服务器端msg_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.6" data-path="../TeamTalk源码解析/06服务器端login_server源码分析.html">
            
                <a href="../TeamTalk源码解析/06服务器端login_server源码分析.html">
            
                    
                    06 服务器端login_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.7" data-path="../TeamTalk源码解析/07服务器端msfs源码分析.html">
            
                <a href="../TeamTalk源码解析/07服务器端msfs源码分析.html">
            
                    
                    07 服务器端msfs源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.8" data-path="../TeamTalk源码解析/08服务器端file_server源码分析.html">
            
                <a href="../TeamTalk源码解析/08服务器端file_server源码分析.html">
            
                    
                    08 服务器端file_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.9" data-path="../TeamTalk源码解析/09服务器端route_server源码分析.html">
            
                <a href="../TeamTalk源码解析/09服务器端route_server源码分析.html">
            
                    
                    09 服务器端route_server源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.10" data-path="../TeamTalk源码解析/10开放一个TeamTalk测试服务器地址和几个测试账号.html">
            
                <a href="../TeamTalk源码解析/10开放一个TeamTalk测试服务器地址和几个测试账号.html">
            
                    
                    10 开放一个TeamTalk测试服务器地址和几个测试账号
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.11" data-path="../TeamTalk源码解析/11pc客户端源码分析.html">
            
                <a href="../TeamTalk源码解析/11pc客户端源码分析.html">
            
                    
                    11 pc客户端源码分析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="7.1" data-path="../libevent源码深度剖析/">
            
                <a href="../libevent源码深度剖析/">
            
                    
                    libevent源码深度剖析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1.1" data-path="../libevent源码深度剖析/libevent源码深度剖析01.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析01.html">
            
                    
                    libevent源码深度剖析01
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.2" data-path="../libevent源码深度剖析/libevent源码深度剖析02.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析02.html">
            
                    
                    libevent源码深度剖析02
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.3" data-path="../libevent源码深度剖析/libevent源码深度剖析03.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析03.html">
            
                    
                    libevent源码深度剖析03
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.4" data-path="../libevent源码深度剖析/libevent源码深度剖析04.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析04.html">
            
                    
                    libevent源码深度剖析04
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.5" data-path="../libevent源码深度剖析/libevent源码深度剖析05.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析05.html">
            
                    
                    libevent源码深度剖析05
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.6" data-path="../libevent源码深度剖析/libevent源码深度剖析06.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析06.html">
            
                    
                    libevent源码深度剖析06
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.7" data-path="../libevent源码深度剖析/libevent源码深度剖析07.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析07.html">
            
                    
                    libevent源码深度剖析07
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.8" data-path="../libevent源码深度剖析/libevent源码深度剖析08.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析08.html">
            
                    
                    libevent源码深度剖析08
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.9" data-path="../libevent源码深度剖析/libevent源码深度剖析09.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析09.html">
            
                    
                    libevent源码深度剖析09
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.10" data-path="../libevent源码深度剖析/libevent源码深度剖析10.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析10.html">
            
                    
                    libevent源码深度剖析10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.11" data-path="../libevent源码深度剖析/libevent源码深度剖析11.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析11.html">
            
                    
                    libevent源码深度剖析11
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.12" data-path="../libevent源码深度剖析/libevent源码深度剖析12.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析12.html">
            
                    
                    libevent源码深度剖析12
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.1.13" data-path="../libevent源码深度剖析/libevent源码深度剖析13.html">
            
                <a href="../libevent源码深度剖析/libevent源码深度剖析13.html">
            
                    
                    libevent源码深度剖析13
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="../leveldb源码分析/">
            
                <a href="../leveldb源码分析/">
            
                    
                    leveldb源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.2.1" data-path="../leveldb源码分析/leveldb源码分析1.html">
            
                <a href="../leveldb源码分析/leveldb源码分析1.html">
            
                    
                    leveldb源码分析1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.2" data-path="../leveldb源码分析/leveldb源码分析2.html">
            
                <a href="../leveldb源码分析/leveldb源码分析2.html">
            
                    
                    leveldb源码分析2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.3" data-path="../leveldb源码分析/leveldb源码分析3.html">
            
                <a href="../leveldb源码分析/leveldb源码分析3.html">
            
                    
                    leveldb源码分析3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.4" data-path="../leveldb源码分析/leveldb源码分析4.html">
            
                <a href="../leveldb源码分析/leveldb源码分析4.html">
            
                    
                    leveldb源码分析4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.5" data-path="../leveldb源码分析/leveldb源码分析5.html">
            
                <a href="../leveldb源码分析/leveldb源码分析5.html">
            
                    
                    leveldb源码分析5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.6" data-path="../leveldb源码分析/leveldb源码分析6.html">
            
                <a href="../leveldb源码分析/leveldb源码分析6.html">
            
                    
                    leveldb源码分析6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.7" data-path="../leveldb源码分析/leveldb源码分析7.html">
            
                <a href="../leveldb源码分析/leveldb源码分析7.html">
            
                    
                    leveldb源码分析7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.8" data-path="../leveldb源码分析/leveldb源码分析8.html">
            
                <a href="../leveldb源码分析/leveldb源码分析8.html">
            
                    
                    leveldb源码分析8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.9" data-path="../leveldb源码分析/leveldb源码分析9.html">
            
                <a href="../leveldb源码分析/leveldb源码分析9.html">
            
                    
                    leveldb源码分析9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.10" data-path="../leveldb源码分析/leveldb源码分析10.html">
            
                <a href="../leveldb源码分析/leveldb源码分析10.html">
            
                    
                    leveldb源码分析10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.11" data-path="../leveldb源码分析/leveldb源码分析11.html">
            
                <a href="../leveldb源码分析/leveldb源码分析11.html">
            
                    
                    leveldb源码分析11
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.12" data-path="../leveldb源码分析/leveldb源码分析12.html">
            
                <a href="../leveldb源码分析/leveldb源码分析12.html">
            
                    
                    leveldb源码分析12
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.13" data-path="../leveldb源码分析/leveldb源码分析13.html">
            
                <a href="../leveldb源码分析/leveldb源码分析13.html">
            
                    
                    leveldb源码分析13
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.14" data-path="../leveldb源码分析/leveldb源码分析14.html">
            
                <a href="../leveldb源码分析/leveldb源码分析14.html">
            
                    
                    leveldb源码分析14
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.15" data-path="../leveldb源码分析/leveldb源码分析15.html">
            
                <a href="../leveldb源码分析/leveldb源码分析15.html">
            
                    
                    leveldb源码分析15
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.16" data-path="../leveldb源码分析/leveldb源码分析16.html">
            
                <a href="../leveldb源码分析/leveldb源码分析16.html">
            
                    
                    leveldb源码分析16
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.17" data-path="../leveldb源码分析/leveldb源码分析17.html">
            
                <a href="../leveldb源码分析/leveldb源码分析17.html">
            
                    
                    leveldb源码分析17
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.18" data-path="../leveldb源码分析/leveldb源码分析18.html">
            
                <a href="../leveldb源码分析/leveldb源码分析18.html">
            
                    
                    leveldb源码分析18
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.19" data-path="../leveldb源码分析/leveldb源码分析19.html">
            
                <a href="../leveldb源码分析/leveldb源码分析19.html">
            
                    
                    leveldb源码分析19
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.20" data-path="../leveldb源码分析/leveldb源码分析20.html">
            
                <a href="../leveldb源码分析/leveldb源码分析20.html">
            
                    
                    leveldb源码分析20
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.21" data-path="../leveldb源码分析/leveldb源码分析21.html">
            
                <a href="../leveldb源码分析/leveldb源码分析21.html">
            
                    
                    leveldb源码分析21
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="7.2.22" data-path="../leveldb源码分析/leveldb源码分析22.html">
            
                <a href="../leveldb源码分析/leveldb源码分析22.html">
            
                    
                    leveldb源码分析22
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="8.1" data-path="./">
            
                <a href="./">
            
                    
                    Memcached源码分析
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1.1" data-path="00服务器资源调整.html">
            
                <a href="00服务器资源调整.html">
            
                    
                    00 服务器资源调整
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.2" data-path="01初始化参数解析.html">
            
                <a href="01初始化参数解析.html">
            
                    
                    01 初始化参数解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.3" data-path="02网络监听的建立.html">
            
                <a href="02网络监听的建立.html">
            
                    
                    02 网络监听的建立
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.4" data-path="03网络连接建立.html">
            
                <a href="03网络连接建立.html">
            
                    
                    03 网络连接建立
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.5" data-path="04内存初始化.html">
            
                <a href="04内存初始化.html">
            
                    
                    04 内存初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.6" data-path="05资源初始化.html">
            
                <a href="05资源初始化.html">
            
                    
                    05 资源初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.7" data-path="06get过程.html">
            
                <a href="06get过程.html">
            
                    
                    06 get过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.8" data-path="07cas属性.html">
            
                <a href="07cas属性.html">
            
                    
                    07 cas属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.9" data-path="08内存池.html">
            
                <a href="08内存池.html">
            
                    
                    08 内存池
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.10" data-path="09连接队列.html">
            
                <a href="09连接队列.html">
            
                    
                    09 连接队列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.11" data-path="10Hash表操作.html">
            
                <a href="10Hash表操作.html">
            
                    
                    10 Hash表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.12" data-path="12set操作.html">
            
                <a href="12set操作.html">
            
                    
                    12 set操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.13" data-path="13do_item_alloc操作.html">
            
                <a href="13do_item_alloc操作.html">
            
                    
                    13 do_item_alloc操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.14" data-path="14item结构.html">
            
                <a href="14item结构.html">
            
                    
                    14 item结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.15" data-path="15Hash表扩容.html">
            
                <a href="15Hash表扩容.html">
            
                    
                    15 Hash表扩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="8.1.16" data-path="16线程交互.html">
            
                <a href="16线程交互.html">
            
                    
                    16 线程交互
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="8.1.17" data-path="17状态机.html">
            
                <a href="17状态机.html">
            
                    
                    17 状态机
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="9.1" data-path="../游戏开发专题/">
            
                <a href="../游戏开发专题/">
            
                    
                    游戏开发专题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1.1" data-path="../游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.html">
            
                <a href="../游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.html">
            
                    
                    1 游戏服务器开发的基本体系与服务器端开发的一些建议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.2" data-path="../游戏开发专题/2网络游戏服务器开发框架设计介绍.html">
            
                <a href="../游戏开发专题/2网络游戏服务器开发框架设计介绍.html">
            
                    
                    2 网络游戏服务器开发框架设计介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.3" data-path="../游戏开发专题/3游戏后端开发需要掌握的知识.html">
            
                <a href="../游戏开发专题/3游戏后端开发需要掌握的知识.html">
            
                    
                    3 游戏后端开发需要掌握的知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.4" data-path="../游戏开发专题/4关于游戏服务端架构的整理.html">
            
                <a href="../游戏开发专题/4关于游戏服务端架构的整理.html">
            
                    
                    4 关于游戏服务端架构的整理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.5" data-path="../游戏开发专题/5各类游戏对应的服务端架构.html">
            
                <a href="../游戏开发专题/5各类游戏对应的服务端架构.html">
            
                    
                    5 各类游戏对应的服务端架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.6" data-path="../游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.html">
            
                <a href="../游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.html">
            
                    
                    6 从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.7" data-path="../游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.html">
            
                <a href="../游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.html">
            
                    
                    7 QQ游戏百万人同时在线服务器架构实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.8" data-path="../游戏开发专题/8大型多人在线游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/8大型多人在线游戏服务器架构设计.html">
            
                    
                    8 大型多人在线游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.9" data-path="../游戏开发专题/9百万用户级游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/9百万用户级游戏服务器架构设计.html">
            
                    
                    9 百万用户级游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.10" data-path="../游戏开发专题/10十万在线的WebGame的数据库设计思路.html">
            
                <a href="../游戏开发专题/10十万在线的WebGame的数据库设计思路.html">
            
                    
                    10 十万在线的WebGame的数据库设计思路
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.11" data-path="../游戏开发专题/11一种高性能网络游戏服务器架构设计.html">
            
                <a href="../游戏开发专题/11一种高性能网络游戏服务器架构设计.html">
            
                    
                    11 一种高性能网络游戏服务器架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.12" data-path="../游戏开发专题/12经典游戏服务器端架构概述.html">
            
                <a href="../游戏开发专题/12经典游戏服务器端架构概述.html">
            
                    
                    12 经典游戏服务器端架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="9.1.13" data-path="../游戏开发专题/13游戏跨服架构进化之路.html">
            
                <a href="../游戏开发专题/13游戏跨服架构进化之路.html">
            
                    
                    13 游戏跨服架构进化之路
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Part IV</li>
        
        
    
        <li class="chapter " data-level="10.1" data-path="../程序员面试题精讲/">
            
                <a href="../程序员面试题精讲/">
            
                    
                    程序员面试题精讲
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.1.1" data-path="../程序员面试题精讲/腾讯后台开发实习生技能要求.html">
            
                <a href="../程序员面试题精讲/腾讯后台开发实习生技能要求.html">
            
                    
                    腾讯后台开发实习生技能要求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.2" data-path="../程序员面试题精讲/聊聊如何拿大厂的offer.html">
            
                <a href="../程序员面试题精讲/聊聊如何拿大厂的offer.html">
            
                    
                    聊聊如何拿大厂的 offer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.3" data-path="../程序员面试题精讲/网络通信题目集锦.html">
            
                <a href="../程序员面试题精讲/网络通信题目集锦.html">
            
                    
                    网络通信题目集锦
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.4" data-path="../程序员面试题精讲/我面试后端开发经理的经历.html">
            
                <a href="../程序员面试题精讲/我面试后端开发经理的经历.html">
            
                    
                    我面试后端开发经理的经历
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.1.5" data-path="../程序员面试题精讲/LinuxCC++后端开发面试问哪些问题.html">
            
                <a href="../程序员面试题精讲/LinuxCC++后端开发面试问哪些问题.html">
            
                    
                    Linux C/C++后端开发面试问哪些问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.2" data-path="../职业规划/">
            
                <a href="../职业规划/">
            
                    
                    职业规划
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.2.1" data-path="../职业规划/给工作4年迷茫的程序员们的一点建议.html">
            
                <a href="../职业规划/给工作4年迷茫的程序员们的一点建议.html">
            
                    
                    给工作 4 年迷茫的程序员们的一点建议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.2.2" data-path="../职业规划/聊聊技术人员的常见的职业问题.html">
            
                <a href="../职业规划/聊聊技术人员的常见的职业问题.html">
            
                    
                    聊聊技术人员的常见的职业问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.2.3" data-path="../职业规划/写给那些傻傻想做服务器开发的朋友.html">
            
                <a href="../职业规划/写给那些傻傻想做服务器开发的朋友.html">
            
                    
                    写给那些傻傻想做服务器开发的朋友
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.3" data-path="../自我提升与开源代码/">
            
                <a href="../自我提升与开源代码/">
            
                    
                    自我提升与开源代码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.3.1" data-path="../自我提升与开源代码/2020年好好读一读开源代码吧.html">
            
                <a href="../自我提升与开源代码/2020年好好读一读开源代码吧.html">
            
                    
                    2020 年好好读一读开源代码吧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.4" data-path="../后端开发相关的书籍/">
            
                <a href="../后端开发相关的书籍/">
            
                    
                    后端开发相关的书籍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.4.1" data-path="../后端开发相关的书籍/后台开发应该读的书.html">
            
                <a href="../后端开发相关的书籍/后台开发应该读的书.html">
            
                    
                    后台开发应该读的书
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.5" data-path="../程序员的简历/">
            
                <a href="../程序员的简历/">
            
                    
                    程序员的简历
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.5.1" data-path="../程序员的简历/程序员如何写简历.html">
            
                <a href="../程序员的简历/程序员如何写简历.html">
            
                    
                    程序员如何写简历
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.6" data-path="../程序员的薪资与年终奖那些事儿/">
            
                <a href="../程序员的薪资与年终奖那些事儿/">
            
                    
                    程序员的薪资与年终奖那些事儿
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.6.1" data-path="../程序员的薪资与年终奖那些事儿/技术面试与HR谈薪资技巧.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/技术面试与HR谈薪资技巧.html">
            
                    
                    技术面试与HR谈薪资技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.6.2" data-path="../程序员的薪资与年终奖那些事儿/聊一聊程序员如何增加收入.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/聊一聊程序员如何增加收入.html">
            
                    
                    聊一聊程序员如何增加收入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.6.3" data-path="../程序员的薪资与年终奖那些事儿/谈一谈年终奖.html">
            
                <a href="../程序员的薪资与年终奖那些事儿/谈一谈年终奖.html">
            
                    
                    谈一谈年终奖
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.7" data-path="../程序员的烦心事/">
            
                <a href="../程序员的烦心事/">
            
                    
                    程序员的烦心事
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.7.1" data-path="../程序员的烦心事/拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？.html">
            
                <a href="../程序员的烦心事/拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？.html">
            
                    
                    拒绝了一家公司的offer后，他们的副总和hr总监同时打电话来询问拒绝原因并极力要求加入，我该不该去？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.7.2" data-path="../程序员的烦心事/我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？.html">
            
                <a href="../程序员的烦心事/我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？.html">
            
                    
                    我是一名程序员，结婚时女友要求我用两年的工资作为彩礼，我该不该答应？
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="10.8" data-path="../作者的故事/">
            
                <a href="../作者的故事/">
            
                    
                    作者的故事
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="10.8.1" data-path="../作者的故事/我的2019.html">
            
                <a href="../作者的故事/我的2019.html">
            
                    
                    我的 2019
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="10.8.2" data-path="../作者的故事/我是如何年薪五十万的.html">
            
                <a href="../作者的故事/我是如何年薪五十万的.html">
            
                    
                    我是如何年薪五十万的
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


		</nav>
		
		
	</div>

	<!-- Content nav -->
	<div class="book-anchor">
		<div class="book-anchor-title">在这篇文章中:</div>
		<div class="book-anchor-body">

		</div>
	</div>

	<div class="book-body">
		
		<div class="body-inner">
			
			

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >17 状态机</a>
    </h1>
</div>




			<div class="page-wrapper" tabindex="-1" role="main">
				<div class="page-inner">
					
<div id="book-search-results">
    <div class="search-noresults">
    
					<section class="normal markdown-section">
						
						<div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03;-&#x72B6;&#x6001;&#x673A;"><b></b>Memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03; &#x72B6;&#x6001;&#x673A;</a></li></ul></div><h1 id="memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03;-&#x72B6;&#x6001;&#x673A;"><a name="memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03;-&#x72B6;&#x6001;&#x673A;" class="anchor-navigation-ex-anchor" href="#memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03;-&#x72B6;&#x6001;&#x673A;"><i class="fa fa-link" aria-hidden="true"></i></a>Memcached&#x6E90;&#x7801;&#x9605;&#x8BFB;&#x5341;&#x4E03; &#x72B6;&#x6001;&#x673A;</h1>
<p>&#x6309;&#x6211;&#x4EEC;&#x4E4B;&#x524D;&#x7684;&#x63CF;&#x8FF0;&#xFF0C;<strong>Master&#x7EBF;&#x7A0B;</strong>&#x5EFA;&#x7ACB;&#x8FDE;&#x63A5;&#x4E4B;&#x540E;&#xFF0C;&#x5206;&#x53D1;&#x7ED9;<strong>Worker&#x7EBF;&#x7A0B;</strong>&#xFF0C;&#x800C;Worker&#x7EBF;&#x7A0B;&#x5904;&#x7406;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x65F6;&#xFF0C;&#x4F1A;&#x8FDB;&#x5165;&#x72B6;&#x6001;&#x673A;&#xFF0C;&#x72B6;&#x6001;&#x673A;&#x6309;&#x4E0D;&#x540C;&#x7684;&#x72B6;&#x6001;&#x5904;&#x7406;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#xFF0C;&#x6211;&#x4EEC;&#x5728;&#x5206;&#x6790;&#x8FDE;&#x63A5;&#x5206;&#x53D1;&#x65F6;&#xFF0C;&#x5DF2;&#x7ECF;&#x770B;&#x5230;&#x4E86;Master&#x7EBF;&#x7A0B;&#x8FDB;&#x5165;&#x72B6;&#x6001;&#x673A;&#x65F6;&#x5728;&#x6709;&#x65B0;&#x8FDE;&#x63A5;&#x5EFA;&#x7ACB;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x540E;&#x7EED;&#x7684;&#x72B6;&#x6001;&#x90FD;&#x662F;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x5176;&#x5904;&#x7406;&#x6D41;&#x7A0B;&#x5982;&#x4E0B;&#x56FE;&#x6240;&#x793A;&#xFF1A;</p>
<p><img src="../imgs/memcached4.webp" alt=""></p>
<p>&#x5171;&#x6709;10&#x4E2A;&#x72B6;&#x6001;&#xFF08;&#x4EE3;&#x7801;&#x4E2D;&#x7684;&#x72B6;&#x6001;&#x4E0D;&#x6B62;&#x8FD9;&#x4E9B;&#xFF0C;&#x6709;&#x4E9B;&#x6CA1;&#x4EC0;&#x4E48;&#x7528;&#xFF0C;&#x6B64;&#x5904;&#x5C31;&#x6CA1;&#x5C55;&#x73B0;&#xFF09;&#xFF0C;&#x72B6;&#x6001;<code>listenning</code>&#x72B6;&#x6001;&#x662F;Master&#x5EFA;&#x7ACB;&#x8FDE;&#x63A5;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5206;&#x6790;&#x8FC7;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x63A5;&#x4E0B;&#x6765;&#x5206;&#x4E0D;&#x540C;&#x7684;&#x6587;&#x7AE0;&#x5206;&#x6790;&#x5176;&#x4F59;&#x7684;9&#x4E2D;&#x72B6;&#x6001;&#x3002;</p>
<pre class="language-"><code>enum conn_states {
    conn_listening,  //&#x76D1;&#x542C;&#x72B6;&#x6001;
    conn_new_cmd,    //&#x4E3A;&#x65B0;&#x8FDE;&#x63A5;&#x505A;&#x4E00;&#x4E9B;&#x51C6;&#x5907;
    conn_waiting,    //&#x7B49;&#x5F85;&#x8BFB;&#x53D6;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5305;
    conn_read,       //&#x8BFB;&#x53D6;&#x7F51;&#x7EDC;&#x6570;&#x636E;
    conn_parse_cmd,  //&#x89E3;&#x6790;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x6570;&#x636E;
    conn_write,      //&#x7B80;&#x5355;&#x7684;&#x56DE;&#x590D;&#x6570;&#x636E;
    conn_nread,      //&#x8BFB;&#x53D6;&#x56FA;&#x5B9A;&#x6570;&#x636E;&#x7684;&#x7F51;&#x7EDC;&#x6570;&#x636E;
    conn_swallow,    //&#x5904;&#x7406;&#x4E0D;&#x9700;&#x8981;&#x7684;&#x5199;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x6570;&#x636E;
    conn_closing,    //&#x5173;&#x95ED;&#x8FDE;&#x63A5;
    conn_mwrite,     //&#x987A;&#x5E8F;&#x7684;&#x5199;&#x591A;&#x4E2A;item&#x6570;&#x636E;
    conn_max_state   //&#x6700;&#x5927;&#x72B6;&#x6001;&#xFF0C;&#x505A;&#x65AD;&#x8A00;&#x4F7F;&#x7528;
};
</code></pre><p>&#x8FD9;&#x7BC7;&#x6587;&#x4EF6;&#x5148;&#x5206;&#x6790;<code>conn_new_cmd</code>&#x548C;<code>conn_wating</code>&#x72B6;&#x6001;&#xFF0C;&#x5B50;&#x7EBF;&#x7A0B;&#x6700;&#x521D;&#x8FDB;&#x5165;&#x7684;&#x72B6;&#x6001;&#x5C31;&#x662F;conn_new_cmd&#x72B6;&#x6001;&#xFF0C;&#x8FD9;&#x4E2A;&#x72B6;&#x6001;&#x4E3B;&#x8981;&#x662F;&#x505A;&#x4E00;&#x4E9B;&#x6E05;&#x7406;&#x3002;</p>
<pre class="language-"><code>case conn_new_cmd:
  //&#x5168;&#x5C40;&#x53D8;&#x91CF;&#xFF0C;&#x8BB0;&#x5F55;&#x6BCF;&#x4E2A;libevent&#x5B9E;&#x4F8B;&#x5904;&#x7406;&#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x901A;&#x8FC7;&#x521D;&#x59CB;&#x542F;&#x52A8;&#x53C2;&#x6570;&#x914D;&#x7F6E;
     --nreqs;

     //&#x8FD8;&#x53EF;&#x4EE5;&#x5904;&#x7406;&#x8BF7;&#x6C42;
     if (nreqs &gt;= 0)
     {
         //&#x6574;&#x7406;&#x7F13;&#x51B2;&#x533A;
         reset_cmd_handler(c);
     }
     //&#x62D2;&#x7EDD;&#x8BF7;&#x6C42;
     else
     {
         pthread_mutex_lock(&amp;c-&gt;thread-&gt;stats.mutex);
         c-&gt;thread-&gt;stats.conn_yields++;//&#x66F4;&#x65B0;&#x7EDF;&#x8BA1;&#x6570;&#x636E;
         pthread_mutex_unlock(&amp;c-&gt;thread-&gt;stats.mutex);
         //&#x5982;&#x679C;&#x7F13;&#x51B2;&#x533A;&#x6709;&#x6570;&#x636E;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x5904;&#x7406;
         if (c-&gt;rbytes &gt; 0)
         {
             //&#x66F4;&#x65B0;libevent&#x72B6;&#x6001;
             if (!update_event(c, EV_WRITE | EV_PERSIST))
             {
                 if (settings.verbose &gt; 0)
                      fprintf(stderr, &quot;Couldn&apos;t update event\n&quot;);
                   conn_set_state(c, conn_closing);//&#x5173;&#x95ED;&#x8FDE;&#x63A5;
             }
         }
         stop = true;
     }
     break;
</code></pre><pre class="language-"><code>//&#x6574;&#x7406;&#x7F13;&#x51B2;&#x533A;
static void reset_cmd_handler(conn *c)
{
    c-&gt;cmd = -1;
    c-&gt;substate = bin_no_state;
    //&#x8FD8;&#x6709;item
    if (c-&gt;item != NULL)
    {
        //&#x5220;&#x9664;item&#xFF0C;&#x672C;&#x7BC7;&#x4E0D;&#x5206;&#x6790;&#x5176;&#x5B9E;&#x73B0;&#xFF0C;&#x540E;&#x7EED;&#x5206;&#x6790;
        item_remove(c-&gt;item);
        c-&gt;item = NULL;
    }
    //&#x6574;&#x7406;&#x7F13;&#x51B2;&#x533A;
    conn_shrink(c);
    //&#x7F13;&#x51B2;&#x533A;&#x8FD8;&#x6709;&#x6570;&#x636E;
    if (c-&gt;rbytes &gt; 0)
    {
        //&#x66F4;&#x65B0;&#x72B6;&#x6001;
        conn_set_state(c, conn_parse_cmd);
    }
    //&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6570;&#x636E;
    else
    {
        //&#x8FDB;&#x5165;&#x7B49;&#x5F85;&#x72B6;&#x6001;&#xFF0C;&#x72B6;&#x6001;&#x673A;&#x6CA1;&#x6709;&#x6570;&#x636E;&#x8981;&#x5904;&#x7406;&#xFF0C;&#x5C31;&#x8FDB;&#x5165;&#x8FD9;&#x4E2A;&#x72B6;&#x6001;
        conn_set_state(c, conn_waiting);
    }
}

//&#x7F29;&#x5C0F;&#x7F13;&#x51B2;&#x533A;
static void conn_shrink(conn *c)
{
    assert(c != NULL);

    //&#x5982;&#x679C;&#x662F;UDP&#x534F;&#x8BAE;&#xFF0C;&#x4E0D;&#x7275;&#x6D89;&#x7F13;&#x51B2;&#x533A;&#x7BA1;&#x7406;
    if (IS_UDP(c-&gt;transport))
        return;
    //&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x7A7A;&#x95F4;&#x5927;&#x5C0F;&gt;READ_BUFFER_HIGHWAT &amp;&amp; &#x5DF2;&#x7ECF;&#x8BFB;&#x5230;&#x7684;&#x6570;&#x636E;&#x8FD8;&#x6CA1;&#x89E3;&#x6790;&#x7684;&#x6570;&#x636E;&#x5C0F;&#x4E8E; DATA_BUFFER_SIZE
    if (c-&gt;rsize &gt; READ_BUFFER_HIGHWAT &amp;&amp; c-&gt;rbytes &lt; DATA_BUFFER_SIZE)
    {
        char *newbuf;

        if (c-&gt;rcurr != c-&gt;rbuf)
            //&#x76EE;&#x524D;&#x6570;&#x636E;&#x662F;&#x4ECE;rcurr&#x5F00;&#x59CB;&#x7684;&#xFF0C;&#x79FB;&#x52A8;&#x6570;&#x636E;&#x5230;rbuf&#x4E2D;
            memmove(c-&gt;rbuf, c-&gt;rcurr, (size_t) c-&gt;rbytes);

        //&#x6309;DATA_BUFFER_SIZE&#x6269;&#x5927;&#x7F13;&#x51B2;&#x533A;
        newbuf = (char *) realloc((void *) c-&gt;rbuf, DATA_BUFFER_SIZE);
        if (newbuf)
        {
            //&#x66F4;&#x65B0;&#x8BFB;&#x7F13;&#x51B2;&#x533A;
            c-&gt;rbuf = newbuf;
            //&#x66F4;&#x65B0;&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x5927;&#x5C0F;
            c-&gt;rsize = DATA_BUFFER_SIZE;
        }
        c-&gt;rcurr = c-&gt;rbuf;
    }

    //&#x9700;&#x8981;&#x5199;&#x51FA;&#x7684;item&#x7684;&#x4E2A;&#x6570;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8981;&#x53D1;&#x9001;&#x7ED9;&#x5BA2;&#x6237;&#x7AEF;&#x7684;item&#x7684;&#x4E2A;&#x6570;
    if (c-&gt;isize &gt; ITEM_LIST_HIGHWAT)
    {
        //&#x589E;&#x5927;&#x5B58;&#x653E;item&#x7684;&#x7A7A;&#x95F4;
        item **newbuf = (item**) realloc((void *) c-&gt;ilist,ITEM_LIST_INITIAL * sizeof(c-&gt;ilist[0]));
        if (newbuf)
        {
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;ilist = newbuf;
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;isize = ITEM_LIST_INITIAL;
        }
    }

    //msghdr&#x7684;&#x4E2A;&#x6570;&#xFF0C;memcached&#x53D1;&#x9001;&#x6D88;&#x606F;&#x662F;&#x901A;&#x8FC7;sendmsg&#x6279;&#x91CF;&#x53D1;&#x9001;&#x7684;
    if (c-&gt;msgsize &gt; MSG_LIST_HIGHWAT)
    {
        struct msghdr *newbuf = (struct msghdr *) realloc((void *) c-&gt;msglist,MSG_LIST_INITIAL * sizeof(c-&gt;msglist[0]));//&#x589E;&#x5927;&#x7A7A;&#x95F4;
        if (newbuf)
        {
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;msglist = newbuf;
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;msgsize = MSG_LIST_INITIAL;
        }
    }

    //msghdr&#x91CC;&#x9762;iov&#x7684;&#x6570;&#x91CF;
    if (c-&gt;iovsize &gt; IOV_LIST_HIGHWAT)
    {
        //&#x589E;&#x5927;&#x7A7A;&#x95F4;
        struct iovec *newbuf = (struct iovec *) realloc((void *) c-&gt;iov,IOV_LIST_INITIAL * sizeof(c-&gt;iov[0]));
        if (newbuf)
        {
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;iov = newbuf;
            //&#x66F4;&#x65B0;&#x4FE1;&#x606F;
            c-&gt;iovsize = IOV_LIST_INITIAL;
        }
    }
}
</code></pre><p>&#x4ECE;<code>conn_new_cmd</code>&#x72B6;&#x6001;&#x4F1A;&#x8FDB;&#x5165;<code>conn_parse_cmd</code>&#x72B6;&#x6001;&#xFF08;&#x5982;&#x679C;&#x6709;&#x6570;&#x636E;&#xFF09;&#x6216;&#x8005;conn_waiting&#xFF08;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6570;&#x636E;&#xFF09;&#x72B6;&#x6001;&#xFF0C;&#x4E0B;&#x9762;&#x770B;&#x770B;conn_waiting&#x72B6;&#x6001;&#x3002;</p>
<pre class="language-"><code>case conn_waiting:
  //&#x4FEE;&#x6539;libevent&#x72B6;&#x6001;&#xFF0C;&#x8BFB;&#x53D6;&#x6570;&#x636E;
  if (!update_event(c, EV_READ | EV_PERSIST))
     {
         if (settings.verbose &gt; 0)
             fprintf(stderr, &quot;Couldn&apos;t update event\n&quot;);
         conn_set_state(c, conn_closing);
         break;
     }
     //&#x8FDB;&#x5165;&#x8BFB;&#x6570;&#x636E;&#x72B6;&#x6001;
     conn_set_state(c, conn_read);
     stop = true;
     break;
//&#x66F4;&#x65B0;libevent&#x72B6;&#x6001;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x5220;&#x9664;libevent&#x4E8B;&#x4EF6;&#x540E;&#xFF0C;&#x91CD;&#x65B0;&#x6CE8;&#x518C;libevent&#x4E8B;&#x4EF6;
static bool update_event(conn *c, const int new_flags)
{
     assert(c != NULL);
     struct event_base *base = c-&gt;event.ev_base;

     if (c-&gt;ev_flags == new_flags)
        return true;
     //&#x5220;&#x9664;&#x65E7;&#x7684;&#x4E8B;&#x4EF6;
     if (event_del(&amp;c-&gt;event) == -1)
        return false;

     //&#x6CE8;&#x518C;&#x65B0;&#x4E8B;&#x4EF6;
     event_set(&amp;c-&gt;event, c-&gt;sfd, new_flags, event_handler, (void *) c);
     event_base_set(base, &amp;c-&gt;event); 
     c-&gt;ev_flags = new_flags;

     if (event_add(&amp;c-&gt;event, 0) == -1)
       return false;
     return true;
}
</code></pre><p><code>conn_wating</code>&#x72B6;&#x6001;&#x662F;&#x5728;&#x7B49;&#x5F85;&#x8BFB;&#x53D6;&#x6570;&#x636E;&#xFF0C;conn_wating&#x901A;&#x8FC7;&#x4FEE;&#x6539;libevent&#x4E8B;&#x4EF6;&#xFF08;&#x4FEE;&#x6539;&#x4E3A;&#x8BFB;&#x4E8B;&#x4EF6;&#xFF09;&#x4E4B;&#x540E;&#x5C31;&#x8FDB;&#x5165;&#x4E86;<code>conn_read</code>&#x72B6;&#x6001;&#xFF0C;&#x8BE5;&#x72B6;&#x6001;&#x5C31;&#x662F;&#x4ECE;<strong>&#x7F51;&#x7EDC;&#x4E2D;&#x8BFB;&#x53D6;&#x6570;&#x636E;</strong>&#xFF0C;&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x8BE6;&#x7EC6;&#x5206;&#x6790;<code>conn_read</code>&#x72B6;&#x6001;&#x3002;</p>
<pre class="language-"><code>case conn_read:
     res = IS_UDP(c-&gt;transport) ? try_read_udp(c) : try_read_network(c);//&#x5224;&#x65AD;&#x91C7;&#x7528;UDP&#x534F;&#x8BAE;&#x8FD8;&#x662F;TCP&#x534F;&#x8BAE;

     switch (res)
     {
     case READ_NO_DATA_RECEIVED://&#x672A;&#x8BFB;&#x53D6;&#x5230;&#x6570;&#x636E;
         conn_set_state(c, conn_waiting);//&#x7EE7;&#x7EED;&#x7B49;&#x5F85;
         break;
     case READ_DATA_RECEIVED://&#x8BFB;&#x53D6;&#x6570;&#x636E;
         conn_set_state(c, conn_parse_cmd);//&#x5F00;&#x59CB;&#x89E3;&#x6790;&#x6570;&#x636E;
         break;
     case READ_ERROR://&#x8BFB;&#x53D6;&#x53D1;&#x751F;&#x9519;&#x8BEF;
         conn_set_state(c, conn_closing);//&#x5173;&#x95ED;&#x8FDE;&#x63A5;
         break;
     case READ_MEMORY_ERROR: //&#x7533;&#x8BF7;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x9519;&#x8BEF;&#xFF0C;&#x7EE7;&#x7EED;&#x5C1D;&#x8BD5;
         break;
     }
     break;
//&#x91C7;&#x7528;TCP&#x534F;&#x8BAE;&#xFF0C;&#x4ECE;&#x7F51;&#x7EDC;&#x8BFB;&#x53D6;&#x6570;&#x636E;
static enum try_read_result try_read_network(conn *c)
{
    enum try_read_result gotdata = READ_NO_DATA_RECEIVED;
    int res;
    int num_allocs = 0;
    assert(c != NULL);

    //rcurr&#x6807;&#x8BB0;&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x5F00;&#x59CB;&#x4F4D;&#x7F6E;&#xFF0C;&#x5982;&#x679C;&#x4E0D;&#x5728;&#xFF0C;&#x901A;&#x8FC7;memmove&#x8C03;&#x6574;
    if (c-&gt;rcurr != c-&gt;rbuf)
    {
        if (c-&gt;rbytes != 0)
            memmove(c-&gt;rbuf, c-&gt;rcurr, c-&gt;rbytes);
        //rcurr&#x6307;&#x5411;&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x8D77;&#x59CB;&#x4F4D;&#x7F6E;
        c-&gt;rcurr = c-&gt;rbuf;
    }

    //&#x5FAA;&#x73AF;&#x8BFB;&#x53D6;
    while (1)
    {
        //&#x5DF2;&#x7ECF;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;&#x5927;&#x4E8E;&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x5927;&#x5C0F;
        if (c-&gt;rbytes &gt;= c-&gt;rsize)
        {
            if (num_allocs == 4)
            {
                return gotdata;
            }
            ++num_allocs;
            //&#x6309;2&#x500D;&#x6269;&#x5BB9;&#x7A7A;&#x95F4;
            char *new_rbuf = realloc(c-&gt;rbuf, c-&gt;rsize * 2);

            //realloc&#x53D1;&#x751F;&#x9519;&#x8BEF;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x7533;&#x8BF7;&#x5185;&#x5B58;&#x5931;&#x8D25;
            if (!new_rbuf)
            {
                if (settings.verbose &gt; 0)
                    fprintf(stderr, &quot;Couldn&apos;t realloc input buffer\n&quot;);
                //&#x5FFD;&#x7565;&#x5DF2;&#x7ECF;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;
                c-&gt;rbytes = 0;
                out_string(c, &quot;SERVER_ERROR out of memory reading request&quot;);
                //&#x4E0B;&#x4E00;&#x4E2A;&#x72B6;&#x6001;&#x5C31;&#x662F;conn_closing&#x72B6;&#x6001;
                c-&gt;write_and_go = conn_closing;
                return READ_MEMORY_ERROR;
            }
            //&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x6307;&#x5411;&#x65B0;&#x7684;&#x7F13;&#x51B2;&#x533A;
            c-&gt;rcurr = c-&gt;rbuf = new_rbuf;
            //&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x5927;&#x5C0F;&#x6269;&#x5927;2&#x500D;
            c-&gt;rsize *= 2;
        }

        //&#x8BFB;&#x7F13;&#x51B2;&#x533A;&#x5269;&#x4F59;&#x7A7A;&#x95F4;
        int avail = c-&gt;rsize - c-&gt;rbytes;
        //&#x6267;&#x884C;&#x7F51;&#x7EDC;&#x8BFB;&#x53D6;&#xFF0C;&#x8FD9;&#x4E2A;&#x662F;&#x975E;&#x963B;&#x585E;&#x7684;&#x8BFB;
        res = read(c-&gt;sfd, c-&gt;rbuf + c-&gt;rbytes, avail);
        //&#x5982;&#x679C;&#x8BFB;&#x53D6;&#x5230;&#x4E86;&#x6570;&#x636E;
        if (res &gt; 0)
        {
            pthread_mutex_lock(&amp;c-&gt;thread-&gt;stats.mutex);
            //&#x66F4;&#x65B0;&#x7EBF;&#x7A0B;&#x7684;&#x7EDF;&#x8BA1;&#x6570;&#x636E;
            c-&gt;thread-&gt;stats.bytes_read += res;
            pthread_mutex_unlock(&amp;c-&gt;thread-&gt;stats.mutex);
            //&#x8FD4;&#x56DE;&#x8BFB;&#x53D6;&#x5230;&#x6570;&#x636E;&#x7684;&#x72B6;&#x6001;
            gotdata = READ_DATA_RECEIVED;
            //&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;&#x4E2A;&#x6570;&#x589E;&#x52A0;res
            c-&gt;rbytes += res;

            //&#x6700;&#x591A;&#x8BFB;&#x53D6;&#x5230;avail&#x4E2A;&#xFF0C;&#x5982;&#x679C;&#x5DF2;&#x7ECF;&#x8BFB;&#x5230;&#x4E86;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5C1D;&#x8BD5;&#x7EE7;&#x7EED;&#x8BFB;&#x53D6;
            if (res == avail)
            {
                continue;
            }
            //&#x5426;&#x5219;&#xFF0C;&#x5C0F;&#x4E8E;avail,&#x8868;&#x793A;&#x5DF2;&#x7ECF;&#x6CA1;&#x6570;&#x636E;&#x4E86;&#xFF0C;&#x9000;&#x51FA;&#x5FAA;&#x73AF;&#x3002;
            else
            {
                break;
            }
        }
        //&#x8868;&#x793A;&#x5DF2;&#x7ECF;&#x65AD;&#x5F00;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x4E86;
        if (res == 0)
        {
            return READ_ERROR;
        }
        //&#x56E0;&#x4E3A;&#x662F;&#x975E;&#x963B;&#x585E;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x4F1A;&#x8FD4;&#x56DE;&#x4E0B;&#x9762;&#x7684;&#x4E24;&#x4E2A;&#x9519;&#x8BEF;&#x7801;
        if (res == -1)
        {
            if (errno == EAGAIN || errno == EWOULDBLOCK)
            {
                break;
            }
            return READ_ERROR;
        }
    }
    return gotdata;
}
</code></pre><p>&#x4E0A;&#x9762;&#x63CF;&#x8FF0;&#x7684;&#x662F;TCP&#x7684;&#x6570;&#x636E;&#x8BFB;&#x53D6;&#xFF0C;&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x5206;&#x6790;&#x4E0B;UDP&#x7684;&#x6570;&#x636E;&#x8BFB;&#x53D6;&#xFF0C;UDP&#x662F;&#x6570;&#x636E;&#x62A5;&#x7684;&#x5F62;&#x5F0F;&#xFF0C;&#x8BFB;&#x53D6;&#x5230;&#x4E00;&#x4E2A;&#xFF0C;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x5B8C;&#x6574;&#x7684;&#x6570;&#x636E;&#x62A5;&#xFF0C;&#x6240;&#x4EE5;&#x5176;&#x5904;&#x7406;&#x8FC7;&#x7A0B;&#x7B80;&#x5355;&#x3002;</p>
<pre class="language-"><code>//UDP&#x8BFB;&#x53D6;&#x7F51;&#x7EDC;&#x6570;&#x636E;
static enum try_read_result try_read_udp(conn *c)
{
    int res;

    assert(c != NULL);

    c-&gt;request_addr_size = sizeof(c-&gt;request_addr);
    //&#x6267;&#x884C;UDP&#x7684;&#x7F51;&#x7EDC;&#x8BFB;&#x53D6;
    res = recvfrom(c-&gt;sfd, c-&gt;rbuf, c-&gt;rsize, 0, &amp;c-&gt;request_addr,
        &amp;c-&gt;request_addr_size);

    //UDP&#x6570;&#x636E;&#x5305;&#x5927;&#x5C0F;&#x5927;&#x4E8E;8&#xFF0C;&#x5DF2;&#x7ECF;&#x6709;&#x53EF;&#x80FD;&#x662F;&#x4E1A;&#x52A1;&#x6570;&#x636E;&#x5305;
    if (res &gt; 8)
    {
        unsigned char *buf = (unsigned char *)c-&gt;rbuf;
        pthread_mutex_lock(&amp;c-&gt;thread-&gt;stats.mutex);
        //&#x66F4;&#x65B0;&#x6BCF;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;&#x7EDF;&#x8BA1;&#x6570;&#x636E;
        c-&gt;thread-&gt;stats.bytes_read += res;
        pthread_mutex_unlock(&amp;c-&gt;thread-&gt;stats.mutex);

        /* Beginning of UDP packet is the request ID; save it. */
        c-&gt;request_id = buf[0] * 256 + buf[1];

        //&#x4E00;&#x4E9B;&#x4E1A;&#x52A1;&#x7684;&#x7279;&#x5F81;&#x4FE1;&#x606F;&#x5224;&#x65AD;                   
        if (buf[4] != 0 || buf[5] != 1)
        {
            out_string(c, &quot;SERVER_ERROR multi-packet request not supported&quot;);
            return READ_NO_DATA_RECEIVED;
        }

        /* Don&apos;t care about any of the rest of the header. */
        res -= 8;
        //&#x8C03;&#x6574;&#x7F13;&#x51B2;&#x533A;
        memmove(c-&gt;rbuf, c-&gt;rbuf + 8, res);

        c-&gt;rbytes = res;//&#x66F4;&#x65B0;&#x4FE1;&#x606F;
        c-&gt;rcurr = c-&gt;rbuf;
        return READ_DATA_RECEIVED;
    }
    return READ_NO_DATA_RECEIVED;
}
</code></pre><p>&#x4ECE;&#x7F51;&#x7EDC;&#x8BFB;&#x53D6;&#x4E86;&#x6570;&#x636E;&#x4E4B;&#x540E;&#xFF0C;&#x5C06;&#x4F1A;&#x8FDB;&#x5165;<code>conn_parse_cmd</code>&#x72B6;&#x6001;&#xFF0C;&#x8BE5;&#x72B6;&#x6001;&#x662F;&#x6309;&#x534F;&#x8BAE;&#x6765;&#x89E3;&#x6790;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#x3002;</p>
<pre class="language-"><code>case conn_parse_cmd:
    //&#x89E3;&#x6790;&#x6570;&#x636E;
    if (try_read_command(c) == 0)
    {
         //&#x5982;&#x679C;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;&#x4E0D;&#x591F;&#xFF0C;&#x6211;&#x4EEC;&#x7EE7;&#x7EED;&#x7B49;&#x5F85;&#xFF0C;&#x7B49;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;&#x591F;&#x4E86;&#xFF0C;&#x518D;&#x8FDB;&#x884C;&#x89E3;
         conn_set_state(c, conn_waiting);
    }

    break;
</code></pre><pre class="language-"><code>//memcached&#x652F;&#x6301;&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x548C;&#x6587;&#x672C;&#x534F;&#x8BAE;
static int try_read_command(conn *c)
{
    assert(c != NULL);
    assert(c-&gt;rcurr &lt;= (c-&gt;rbuf + c-&gt;rsize));
    assert(c-&gt;rbytes &gt; 0);

    if (c-&gt;protocol == negotiating_prot || c-&gt;transport == udp_transport)
    {
        //&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x6709;&#x6807;&#x5FD7;&#xFF0C;&#x6309;&#x6807;&#x5FD7;&#x8FDB;&#x884C;&#x533A;&#x5206;
        if ((unsigned char)c-&gt;rbuf[0] == (unsigned char)PROTOCOL_BINARY_REQ)
        {
            c-&gt;protocol = binary_prot;//&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;
        }
        else
        {
            c-&gt;protocol = ascii_prot;//&#x6587;&#x672C;&#x534F;&#x8BAE;
        }

        if (settings.verbose &gt; 1)
        {
            fprintf(stderr, &quot;%d: Client using the %s protocol\n&quot;, c-&gt;sfd,
                prot_text(c-&gt;protocol));
        }
    }

    //&#x5982;&#x679C;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;
    if (c-&gt;protocol == binary_prot)
    {
        //&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x6570;&#x636E;&#x5C0F;&#x4E8E;&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x7684;&#x5934;&#x90E8;&#x957F;&#x5EA6;
        if (c-&gt;rbytes &lt; sizeof(c-&gt;binary_header))
        {
            //&#x8FD4;&#x56DE;&#x7EE7;&#x7EED;&#x8BFB;&#x6570;&#x636E;
            return 0;
        }
        else
        {
#ifdef NEED_ALIGN
            //&#x5982;&#x679C;&#x9700;&#x8981;&#x5BF9;&#x9F50;&#xFF0C;&#x5219;&#x6309;8&#x5B57;&#x8282;&#x5BF9;&#x9F50;&#xFF0C;&#x5BF9;&#x9F50;&#x80FD;&#x63D0;&#x9AD8;CPU&#x8BFB;&#x53D6;&#x7684;&#x6548;&#x7387;
            if (((long)(c-&gt;rcurr)) % 8 != 0)
            {
                //&#x8C03;&#x6574;&#x7F13;&#x51B2;&#x533A;
                memmove(c-&gt;rbuf, c-&gt;rcurr, c-&gt;rbytes);
                c-&gt;rcurr = c-&gt;rbuf;
                if (settings.verbose &gt; 1)
                {
                    fprintf(stderr, &quot;%d: Realign input buffer\n&quot;, c-&gt;sfd);
                }
            }
#endif
            protocol_binary_request_header* req;//&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x5934;
            req = (protocol_binary_request_header*)c-&gt;rcurr;
            //&#x8C03;&#x8BD5;&#x4FE1;&#x606F;
            if (settings.verbose &gt; 1)
            {
                /* Dump the packet before we convert it to host order */
                int ii;
                fprintf(stderr, &quot;&lt;%d Read binary protocol data:&quot;, c-&gt;sfd);
                for (ii = 0; ii &lt; sizeof(req-&gt;bytes); ++ii)
                {
                    if (ii % 4 == 0)
                    {
                        fprintf(stderr, &quot;\n&lt;%d   &quot;, c-&gt;sfd);
                    }
                    fprintf(stderr, &quot; 0x%02x&quot;, req-&gt;bytes[ii]);
                }
                fprintf(stderr, &quot;\n&quot;);
            }

            c-&gt;binary_header = *req;
            c-&gt;binary_header.request.keylen = ntohs(req-&gt;request.keylen);
            c-&gt;binary_header.request.bodylen = ntohl(req-&gt;request.bodylen);
            c-&gt;binary_header.request.cas = ntohll(req-&gt;request.cas);
            //&#x5224;&#x65AD;&#x9B54;&#x6570;&#x662F;&#x5426;&#x5408;&#x6CD5;&#xFF0C;&#x9B54;&#x6570;&#x7528;&#x6765;&#x9632;&#x6B62;TCP&#x7C98;&#x5305;
            if (c-&gt;binary_header.request.magic != PROTOCOL_BINARY_REQ)
            {
                if (settings.verbose)
                {
                    fprintf(stderr, &quot;Invalid magic:  %x\n&quot;,
                        c-&gt;binary_header.request.magic);
                }
                conn_set_state(c, conn_closing);
                return -1;
            }

            c-&gt;msgcurr = 0;
            c-&gt;msgused = 0;
            c-&gt;iovused = 0;
            if (add_msghdr(c) != 0)
            {
                out_string(c, &quot;SERVER_ERROR out of memory&quot;);
                return 0;
            }

            c-&gt;cmd = c-&gt;binary_header.request.opcode;
            c-&gt;keylen = c-&gt;binary_header.request.keylen;
            c-&gt;opaque = c-&gt;binary_header.request.opaque;
            //&#x6E05;&#x9664;&#x5BA2;&#x6237;&#x7AEF;&#x4F20;&#x9012;&#x7684;cas&#x503C;
            c-&gt;cas = 0;

            dispatch_bin_command(c);//&#x534F;&#x8BAE;&#x6570;&#x636E;&#x5904;&#x7406;

            //&#x66F4;&#x65B0;&#x5DF2;&#x7ECF;&#x8BFB;&#x53D6;&#x5230;&#x7684;&#x5B57;&#x8282;&#x6570;&#x636E;
            c-&gt;rbytes -= sizeof(c-&gt;binary_header);
            //&#x66F4;&#x65B0;&#x7F13;&#x51B2;&#x533A;&#x7684;&#x8DEF;&#x6807;&#x4FE1;&#x606F;
            c-&gt;rcurr += sizeof(c-&gt;binary_header);
        }
    }
}
</code></pre><p>&#x6587;&#x672C;&#x534F;&#x8BAE;&#x7684;&#x8FC7;&#x7A0B;&#x548C;&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x7684;&#x8FC7;&#x7A0B;&#x7C7B;&#x4F3C;&#xFF0C;&#x6B64;&#x5904;&#x4E0D;&#x5206;&#x6790;&#xFF0C;&#x53E6;&#x5916;<code>dispatch_bin_command</code>&#x662F;&#x5904;&#x7406;&#x5177;&#x4F53;&#x7684;&#xFF08;&#x6BD4;&#x5982;get,set&#x7B49;&#xFF09;&#x64CD;&#x4F5C;&#x7684;&#xFF0C;&#x548C;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x534F;&#x8BAE;&#x5177;&#x4F53;&#x76F8;&#x5173;&#x7684;&#xFF0C;&#x89E3;&#x6790;&#x5B8C;&#x4E00;&#x4E9B;&#x6570;&#x636E;&#x4E4B;&#x540E;&#xFF0C;&#x4F1A;&#x8FDB;&#x5165;&#x5230;conn_nread&#x7684;&#x6D41;&#x7A0B;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BFB;&#x53D6;&#x6307;&#x5B9A;&#x6570;&#x76EE;&#x6570;&#x636E;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#x4E3B;&#x8981;&#x662F;&#x505A;&#x5177;&#x4F53;&#x7684;&#x64CD;&#x4F5C;&#x4E86;&#xFF0C;&#x6BD4;&#x5982;get&#xFF0C;add&#xFF0C;set&#x64CD;&#x4F5C;&#x3002;</p>
<pre class="language-"><code>case bin_read_set_value:
     complete_update_bin(c);//&#x6267;&#x884C;Update&#x64CD;&#x4F5C;
     break;
case bin_reading_get_key:
     process_bin_get(c);//&#x6267;&#x884C;get&#x64CD;&#x4F5C;
     break;
</code></pre><p>&#x72B6;&#x6001;&#x673A;&#x7684;&#x6574;&#x4E2A;&#x5904;&#x7406;&#x8FC7;&#x7A0B;&#x5C31;&#x4ECB;&#x7ECD;&#x5230;&#x8FD9;&#x91CC;&#xFF0C;&#x5176;&#x4ED6;&#x7684;&#x72B6;&#x6001;&#x6211;&#x4EEC;&#x5C31;&#x4E0D;&#x4ECB;&#x7ECD;&#x4E86;&#xFF0C;&#x4E86;&#x89E3;&#x4E86;&#x8FD9;&#x4E9B;&#x4E4B;&#x540E;&#xFF0C;&#x5176;&#x5B9E;&#x5176;&#x4ED6;&#x72B6;&#x6001;&#x5C31;&#x76F8;&#x5BF9;&#x5BB9;&#x6613;&#x5F88;&#x591A;&#x3002;</p>
<footer class="page-footer"><span class="copyright">&#x5982;&#x9700;&#x4E0B;&#x8F7D;&#x672C;&#x7AD9;&#x5168;&#x90E8;&#x6280;&#x672F;&#x6587;&#x7AE0;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x3010;&#x9AD8;&#x6027;&#x80FD;&#x670D;&#x52A1;&#x5668;&#x5F00;&#x53D1;&#x3011;&#x516C;&#x4F17;&#x53F7;&#x56DE;&#x590D;&#x5173;&#x952E;&#x5B57;&#x201C;&#x6587;&#x7AE0;&#x4E0B;&#x8F7D;&#x201D;&#x5373;&#x53EF;&#x3002;</span><span class="footer-modification">&#x6700;&#x8FD1;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2020-10-03 14:30:18
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
						
					</section>
					
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

				</div>
			</div>
			
		</div>

		
		
		<a href="16线程交互.html" class="navigation navigation-prev " aria-label="Previous page: 16 线程交互">
			<i class="fa fa-angle-left"></i>
		</a>
		
		
		<a href="../游戏开发专题/" class="navigation navigation-next " aria-label="Next page: 游戏开发专题">
			<i class="fa fa-angle-right"></i>
		</a>
		
		
		
	</div>
	<script>
		var gitbook = gitbook || [];
		gitbook.push(function() {
			gitbook.page.hasChanged({"page":{"title":"17 状态机","level":"8.1.17","depth":2,"next":{"title":"游戏开发专题","level":"9.1","depth":1,"path":"articles/游戏开发专题/README.md","ref":"articles/游戏开发专题/README.md","articles":[{"title":"1 游戏服务器开发的基本体系与服务器端开发的一些建议","level":"9.1.1","depth":2,"path":"articles/游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.md","ref":"articles/游戏开发专题/1游戏服务器开发的基本体系与服务器端开发的一些建议.md","articles":[]},{"title":"2 网络游戏服务器开发框架设计介绍","level":"9.1.2","depth":2,"path":"articles/游戏开发专题/2网络游戏服务器开发框架设计介绍.md","ref":"articles/游戏开发专题/2网络游戏服务器开发框架设计介绍.md","articles":[]},{"title":"3 游戏后端开发需要掌握的知识","level":"9.1.3","depth":2,"path":"articles/游戏开发专题/3游戏后端开发需要掌握的知识.md","ref":"articles/游戏开发专题/3游戏后端开发需要掌握的知识.md","articles":[]},{"title":"4 关于游戏服务端架构的整理","level":"9.1.4","depth":2,"path":"articles/游戏开发专题/4关于游戏服务端架构的整理.md","ref":"articles/游戏开发专题/4关于游戏服务端架构的整理.md","articles":[]},{"title":"5 各类游戏对应的服务端架构","level":"9.1.5","depth":2,"path":"articles/游戏开发专题/5各类游戏对应的服务端架构.md","ref":"articles/游戏开发专题/5各类游戏对应的服务端架构.md","articles":[]},{"title":"6 从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则","level":"9.1.6","depth":2,"path":"articles/游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.md","ref":"articles/游戏开发专题/6从腾讯QQgame高性能服务器集群架构看“分而治之”与“自治”等分布式架构设计原则.md","articles":[]},{"title":"7 QQ游戏百万人同时在线服务器架构实现","level":"9.1.7","depth":2,"path":"articles/游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.md","ref":"articles/游戏开发专题/7QQ游戏百万人同时在线服务器架构实现.md","articles":[]},{"title":"8 大型多人在线游戏服务器架构设计","level":"9.1.8","depth":2,"path":"articles/游戏开发专题/8大型多人在线游戏服务器架构设计.md","ref":"articles/游戏开发专题/8大型多人在线游戏服务器架构设计.md","articles":[]},{"title":"9 百万用户级游戏服务器架构设计","level":"9.1.9","depth":2,"path":"articles/游戏开发专题/9百万用户级游戏服务器架构设计.md","ref":"articles/游戏开发专题/9百万用户级游戏服务器架构设计.md","articles":[]},{"title":"10 十万在线的WebGame的数据库设计思路","level":"9.1.10","depth":2,"path":"articles/游戏开发专题/10十万在线的WebGame的数据库设计思路.md","ref":"articles/游戏开发专题/10十万在线的WebGame的数据库设计思路.md","articles":[]},{"title":"11 一种高性能网络游戏服务器架构设计","level":"9.1.11","depth":2,"path":"articles/游戏开发专题/11一种高性能网络游戏服务器架构设计.md","ref":"articles/游戏开发专题/11一种高性能网络游戏服务器架构设计.md","articles":[]},{"title":"12 经典游戏服务器端架构概述","level":"9.1.12","depth":2,"path":"articles/游戏开发专题/12经典游戏服务器端架构概述.md","ref":"articles/游戏开发专题/12经典游戏服务器端架构概述.md","articles":[]},{"title":"13 游戏跨服架构进化之路","level":"9.1.13","depth":2,"path":"articles/游戏开发专题/13游戏跨服架构进化之路.md","ref":"articles/游戏开发专题/13游戏跨服架构进化之路.md","articles":[]}]},"previous":{"title":"16 线程交互","level":"8.1.16","depth":2,"path":"articles/Memcached源码分析/16线程交互.md","ref":"articles/Memcached源码分析/16线程交互.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","-lunr","-search","search-pro","splitter","popup","back-to-top-button","hide-element","prism","-highlight","tbfed-pagefooter","code","anchor-navigation-ex","theme-fexa","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"如需下载本站全部技术文章，可以在【高性能服务器开发】公众号回复关键字“文章下载”即可。","modify_label":"最近更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{},"livereload":{},"splitter":{},"search-pro":{},"popup":{},"theme-fexa":{"search-placeholder":"输入关键字搜索","logo":"./logo.png","favicon":"./favicon.ico"},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"showLevel":false,"associatedWithSummary":true,"mode":"float","showGoTop":false,"printLog":false,"multipleH1":true,"float":{"floatIcon":"fa fa-navicon","showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"back-to-top-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"easy_coder","pdf":{"pageBreaksBefore":"/","headerTemplate":null,"paperSize":"a4","margin":{"right":62,"left":62,"top":36,"bottom":36},"fontSize":12,"fontFamily":"Arial","footerTemplate":null,"chapterMark":"pagebreak","pageNumbers":false},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"isbn":"","variables":{},"title":"高性能服务器开发 技术专栏","links":{},"gitbook":"*","description":"","theme-default":{"showLevel":true},"extension":null},"file":{"path":"articles/Memcached源码分析/17状态机.md","mtime":"2020-10-03T06:30:18.875Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-10-09T15:31:57.905Z"},"basePath":"../..","book":{"language":""}});
		});
	</script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-fexa/fexa.js"></script>
        
    

    </body>
</html>

